TH1D* makeHisto(string filePath, int nx) {
	TH1D* histo = new TH1D("histo0", "Photoelectron spectrum;Npe;count", nx, -.5, nx-.5);

	ifstream ifile(filePath.c_str());

	int buffSize = 128;
	char* buffer = new char[buffSize];
	ifile.getline(buffer, buffSize);

	string temps, /*xs, ys,*/ cs;

	for (int i = 0; !ifile.eof(); i++) {
		temps = buffer;

		size_t pos1 = temps.find('\t', 0);
		size_t pos2 = temps.find('\t', pos1 + 1);

//		xs = temps.substr(0, pos1);
//		ys = temps.substr(pos1 + 1, pos2 - pos1);
		cs = temps.substr(pos2 + 1, temps.size() - 1 - pos2);

		histo->Fill(atof(cs.c_str()));

		ifile.getline(buffer, buffSize);
	}

	ifile.close();
	delete[] buffer;

	return histo;
}
